POV-Ray : Newsgroups : povray.programming : C++ performance : Re: C++ performance Server Time
28 Jul 2024 10:25:56 EDT (-0400)
  Re: C++ performance  
From: Warp
Date: 8 Apr 2002 13:21:57
Message: <3cb1d1b5@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> I found an interesting (draft) paper that provides a fairly detailed
> analysis of the C++ standard library performance regrading speed

  We should distinguish between C++ performance and C++ standard library
performance.
  This is an important difference. Saying that "C++ is slow" when in reality
it is the standard library which is slow is very misleading.
  If the libraries are slow, you can change to another library without
having to change the language.

  The C++ streams is one example of this. For some reason the C++ streams
are considerably slower than the equivalent C streams in practically all
existing C++ compilers (even though there are no technical nor theoretical
reasons for this).
  If your program uses a lot of file-I/O, switching from C++ streams to
C streams can seriously improve the performance of the program (even though
you lose the abstraction of the C++ streams; however, wrapping the C streams
usage inside proper abstraction is always a good idea).
  This was done in POV-Ray because it makes heavy use of file-I/O during
parsing, and using C++ streams made it really slow.

  (Please note that the C++ streams are not bad per se, as I said above.
There is no theoretical or technical reason for them to be slower; they just
are, for one reason or another. In fact, theoretically C++ streams could be
faster than C streams due to the fact that more things can be done at
compilation time instead of having to do them at runtime (eg. printf vs. cout))

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.